#include "CooldownState.h"

#include "InitState.h"
#include "StrategyNode.h"

#include <cstddef>


USING_STOCK_NS
using namespace std;

DealState * CooldownState::_instance = NULL;

DealState * CooldownState::GetInstance()
{
	if (_instance == NULL)
	{
		_instance = new CooldownState();
	}

	return _instance;
}

vector<StrategyNode *> CooldownState::DoAvailableTransaction(StrategyNode * node, float curPrice)
{
	vector<StrategyNode *> children;

	StrategyNode * cooldown_node = new StrategyNode(COOLDOWN);
	cooldown_node->CalcProfit(node->GetProfit(), curPrice);
	cooldown_node->SetState(InitState::GetInstance());
	children.push_back(cooldown_node);

	return children;
}
